home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
13547
/
13547.xpi
/
chrome
/
content
/
options.js
next >
Wrap
Text File
|
2009-11-26
|
5KB
|
143 lines
var display =
{
stuff: function ()
{
var bool1 = document.getElementById("stuff.bool.checkbox").checked;
var bool2 = document.getElementById("stuff.middleClick.checkbox").checked;
var bool3 = bool1 && bool2;
document.getElementById("stuff.middleClick.checkbox").disabled = !bool1;
document.getElementById("stuff.position.label").disabled = !bool3;
document.getElementById("stuff.dx.label").disabled = !bool3;
document.getElementById("stuff.dx.textbox").disabled = !bool3;
document.getElementById("stuff.dy.label").disabled = !bool3;
document.getElementById("stuff.dy.textbox").disabled = !bool3;
document.getElementById("stuff.newChildTab.checkbox").disabled = !bool1;
document.getElementById("stuff.here.checkbox").disabled = !bool1;
},
googleDictionary: function ()
{
var bool = document.getElementById("googleDictionary.bool.checkbox").checked;
document.getElementById("googleDictionary.lang.radio").disabled = !bool;
document.getElementById("googleDictionary.lang.menulist").disabled = !bool;
document.getElementById("googleDictionary.langpair.radio").disabled = !bool;
document.getElementById("googleDictionary.langpair.menulist").disabled = !bool;
var bool = prefs.getBoolPref("googleDictionary.bi");
document.getElementById("googleDictionary.bi.radiogroup").selectedIndex = bool ? 1 : 0;
},
translateThisPage: function ()
{
var bool = document.getElementById("translateThisPage.bool.checkbox").checked;
document.getElementById("translateThisPage.destLang.label").disabled = !bool;
document.getElementById("translateThisPage.destLang.menulist").disabled = !bool;
document.getElementById("translateThisPage.inNewChildTab.checkbox").disabled = !bool;
},
customItem1: function ()
{
var bool = document.getElementById("customItem1.bool.checkbox").checked;
document.getElementById("customItem1.name.label").disabled = !bool;
document.getElementById("customItem1.name.textbox").disabled = !bool;
document.getElementById("customItem1.url.label").disabled = !bool;
document.getElementById("customItem1.url.textbox").disabled = !bool;
},
customItem2: function ()
{
var bool = document.getElementById("customItem2.bool.checkbox").checked;
document.getElementById("customItem2.name.label").disabled = !bool;
document.getElementById("customItem2.name.textbox").disabled = !bool;
document.getElementById("customItem2.url.label").disabled = !bool;
document.getElementById("customItem2.url.textbox").disabled = !bool;
},
customItem3: function ()
{
var bool = document.getElementById("customItem3.bool.checkbox").checked;
document.getElementById("customItem3.name.label").disabled = !bool;
document.getElementById("customItem3.name.textbox").disabled = !bool;
document.getElementById("customItem3.url.label").disabled = !bool;
document.getElementById("customItem3.url.textbox").disabled = !bool;
},
quick: function ()
{
var bool = prefs.getBoolPref("quick.bubble");
document.getElementById("quick.bubble.radiogroup").selectedIndex = bool ? 0 : 1;
var bool = document.getElementById("quick.bool.checkbox").checked;
document.getElementById("quick.srcLang.label").disabled = !bool;
document.getElementById("quick.srcLang.menulist").disabled = !bool;
document.getElementById("quick.destLang.label").disabled = !bool;
document.getElementById("quick.destLang.menulist").disabled = !bool;
document.getElementById("quick.bubble.label").disabled = !bool;
document.getElementById("quick.bubble.radiogroup").disabled = !bool;
document.getElementById("quick.bMax.label1").disabled = !bool;
document.getElementById("quick.bMax.textbox").disabled = !bool;
document.getElementById("quick.bMax.label2").disabled = !bool;
document.getElementById("quick.mMax.label1").disabled = !bool;
document.getElementById("quick.mMax.textbox").disabled = !bool;
document.getElementById("quick.mMax.label2").disabled = !bool;
}
}
var setPref =
{
quick:
{
bubble: function ()
{
var bool = document.getElementById("quick.bubble.radiogroup").selectedIndex == 0;
prefs.setBoolPref("quick.bubble", bool);
}
},
googleDictionary:
{
bi: function ()
{
var bool = document.getElementById("googleDictionary.bi.radiogroup").selectedIndex == 1;
prefs.setBoolPref("googleDictionary.bi", bool);
}
}
}
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch("extensions.aFCA.");
var init = function ()
{
display.googleDictionary();
display.translateThisPage();
display.customItem1();
display.customItem2();
display.customItem3();
display.quick();
display.stuff();
}
window.addEventListener("load", function () {init();}, false);